﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;

namespace Bricks.BaseFramework.GenericForms
{
    public class MsgBox
    {
        #region Show方法
        /// <summary>
        /// 提示窗体
        /// </summary>
        /// <param name="message">提示信息</param>
        /// <returns>MessageBoxResult</returns>
        public static MessageBoxResult Show(string message)
        {
            return ShowCore(null, message, "提示", MessageBoxButton.OK, MessageBoxImage.Information);
        }

        /// <summary>
        /// 提示窗体
        /// </summary>
        /// <param name="message">提示信息</param>
        /// <param name="title">提示标题</param>
        /// <returns>MessageBoxResult</returns>
        public static MessageBoxResult Show(string message, string title)
        {
            return ShowCore(null, message, title, MessageBoxButton.OK, MessageBoxImage.Information);
        }

        /// <summary>
        /// 提示窗体
        /// </summary>
        /// <param name="message">提示信息</param>
        /// <param name="title">提示标题</param>
        /// <param name="buttons">按钮类型</param>
        /// <returns>MessageBoxResult</returns>
        public static MessageBoxResult Show(string message, string title, MessageBoxButton buttons)
        {
            return ShowCore(null, message, title, buttons, MessageBoxImage.Information);
        }

        /// <summary>
        /// 提示窗体
        /// </summary>
        /// <param name="message">提示信息</param>
        /// <param name="title">提示标题</param>
        /// <param name="buttons">按钮类型</param>
        /// <param name="image">图片</param>
        /// <returns>MessageBoxResult</returns>
        public static MessageBoxResult Show(string message, string title, MessageBoxButton buttons, MessageBoxImage image)
        {
            return ShowCore(null, message, title, buttons, image);
        }

        /// <summary>
        /// 提示窗体
        /// </summary>
        /// <param name="owner">父窗体</param>
        /// <param name="message">提示信息</param>
        /// <param name="title">提示标题</param>
        /// <param name="buttons">按钮类型</param>
        /// <param name="image">图片</param>
        /// <returns>MessageBoxResult</returns>
        public static MessageBoxResult Show(Window owner, string message, string title, MessageBoxButton buttons, MessageBoxImage image)
        {
            return ShowCore(owner, message, title, buttons, image);
        }
        #endregion

        #region ShowAlert方法
        /// <summary>
        /// 警告提示窗体
        /// </summary>
        /// <param name="message">提示信息</param>
        /// <returns>MessageBoxResult</returns>
        public static MessageBoxResult ShowAlert(string message)
        {
            return ShowCore(null, message, "提示", MessageBoxButton.OK, MessageBoxImage.Exclamation);
        }

        /// <summary>
        /// 警告提示窗体
        /// </summary>
        /// <param name="message">提示信息</param>
        /// <param name="title">提示标题</param>
        /// <returns>MessageBoxResult</returns>
        public static MessageBoxResult ShowAlert(string message, string title)
        {
            return ShowCore(null, message, title, MessageBoxButton.OK, MessageBoxImage.Exclamation);
        }
        #endregion

        #region ShowQuestion方法
        /// <summary>
        /// 询问提示窗体
        /// </summary>
        /// <param name="message">提示信息</param>
        /// <returns>MessageBoxResult</returns>
        public static MessageBoxResult ShowQuestion(string message)
        {
            return ShowCore(null, message, "提示", MessageBoxButton.YesNo, MessageBoxImage.Question);
        }

        /// <summary>
        /// 询问提示窗体
        /// </summary>
        /// <param name="message">提示信息</param>
        /// <param name="title">提示标题</param>
        /// <returns>MessageBoxResult</returns>
        public static MessageBoxResult ShowQuestion(string message, string title)
        {
            return ShowCore(null, message, title, MessageBoxButton.YesNo, MessageBoxImage.Question);
        }
        #endregion

        #region ShowCore基础方法
        private static MessageBoxResult ShowCore(Window owner, string message, string title, MessageBoxButton buttons, MessageBoxImage image)
        {
            MsgBoxWindow mbWindow = new MsgBoxWindow();
            return mbWindow.ShowCore(owner, message, title, buttons, image);
        }
        #endregion
    }
}
